<template>
<div>
	<div class="page-header md-shadow-z-1-i navbar navbar-fixed-top">
        <div class="page-header-inner">
            <div class="page-logo">
                <a href="index.html">
                <img src="../image/logo.JPG" alt="logo" class="logo-default"/>
                </a>
                <div class="menu-toggler sidebar-toggler">
                </div>
            </div>
            <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
            </a>
            
            <div class="page-top">
                <form class="search-form search-form-expanded" action="extra_search.html" method="GET">

                </form>
                <div class="top-menu">
                    <ul class="nav navbar-nav pull-right">

                        <li class="dropdown dropdown-user">
                            <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                            <img alt="" class="img-circle" src="../image/avatar.png"/>
                            <span class="username username-hide-on-mobile J_username">
                            </span>
                            <i class="fa fa-angle-down"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-default">
                                <li>
                                    <a href="javascript:;" class="J_logout" @click="logout">
                                    <i class="icon-key"></i> 退出 </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
            
        </div>
    </div>

    <div class="clearfix">
    </div>

    <div class="page-container">

		<router-view></router-view>

        <div class="page-footer">
            <div class="page-footer-inner">
                2016 &copy; Gavin. 
            </div>
            <div class="scroll-to-top">
                <i class="icon-arrow-up"></i>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import config from './config'
import toast from '../../src/util/toast'
import {IO} from '../../src/util/io'

export default{
	data(){
		return {

		}
	},
	ready(){
        console.log('frame ready')

        // if(!config.navDataUrl){
        //     toast('warning', '请在config.js文件配置菜单数据地址', '配置错误')
        // }else{
        //     let dataIO = new IO({
        //         url: config.navDataUrl
        //     })

        //     dataIO.get((res)=>{
        //             window.localStorage.setItem('navData', JSON.stringify(res))
        //     })
        // }

        let navData = [
                        {
                            "name": "首页",
                            "link": "home",
                            "icon": "icon-home"
                        },
                        {
                            "name": "组件",
                            "icon": "icon-folder",
                            "children":[
                                
                                {
                                    "name": "面板",
                                    "link": "panel",
                                    "icon": "icon-user"
                                },
                                {
                                    "name": "可拖动面板",
                                    "link": "draggable-panel",
                                    "icon": "icon-basket"
                                },
                                {
                                    "name": "表格",
                                    "link": "table",
                                    "icon": "icon-grid"
                                },
                                {
                                    "name": "模态框",
                                    "link": "modal",
                                    "icon": "icon-note"
                                },
                                {
                                    "name": "Form表单",
                                    "link": "form",
                                    "icon": "icon-doc"
                                }
                            ]
                        },
                        {
                            "name": "文档",
                            "icon": "icon-settings",
                            "children": [
                                {
                                    "name": "项目搭建",
                                    "link": "doc-frame",
                                    "icon": "icon-doc"
                                },
                                {
                                    "name": "第一个页面",
                                    "link": "doc-home",
                                    "icon": "icon-doc"
                                },
                                {
                                    "name": "组件",
                                    "icon": "icon-folder",
                                    "children":[
                                        {
                                            "name": "Page",
                                            "link": "doc-page",
                                            "icon": "icon-doc"
                                        },
                                        {
                                            "name": "Navbar",
                                            "link": "doc-navbar",
                                            "icon": "icon-doc"
                                        },
                                        {
                                            "name": "VTable",
                                            "link": "doc-table",
                                            "icon": "icon-doc"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]

        window.localStorage.setItem('navData', JSON.stringify(navData))

        // this.$nextTick(()=>{
            Layout.init();
        // })
    },
    methods:{
        logout(){
            location.href = 'login.html'
        }
    }
}	
</script>

<style lang="sass">
.page-header.navbar .page-logo .logo-default{
    margin: 10px 0;
    height: 48px;
}
</style>